using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.XPath;
using AntEater.ComponentModel.BuildElements;
using System.Xml;
using AntEater.ComponentModel;

namespace AntEater.Runtime.Services.Transformation
{

    /// <summary>
    /// Provides an Delegate.
    /// </summary>
    /// <param name="element"></param>
    /// <param name="writer"></param>
    internal delegate void GetChildElementsXml(IBuildElement element, XmlWriter writer);

    /// <summary>
    /// Provides an Interface for Transformers.
    /// </summary>
    internal interface IBuildElementTransformer
    {

        /// <summary>
        /// Occurs when the Xml of the Child Elements is needed.
        /// </summary>
        event GetChildElementsXml GetChildElementsXml;

        /// <summary>
        /// Transforms an <c>BuildElement</c> into XML.
        /// </summary>
        /// <param name="buildElement">The build element.</param>
        /// <param name="writer">The writer.</param>
        /// <param name="errors">The errors.</param>
        void GetXml(IBuildElement buildElement, XmlWriter writer, List<TransformationError> errors);

        /// <summary>
        /// Gets an <c>BuildElement</c> from XML.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="buildFileDefinition">The build file definition.</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        IBuildElement GetBuildElement(XPathNavigator node, BuildFileDefinition buildFileDefinition, List<TransformationError> errors);
    }
}
